import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  resolve: {
    //设置根目录别名
    alias: {
      "@": path.resolve(__dirname, 'src')
    }
  },
  base: './',
  server: {
    //启动端口
    port: 5888,
    //服务器代理
    proxy: {
      "/api": {
        //请求地址
        target: "http://localhost:3000",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      }
    }
  },
})
